package me.zk.practice1.s;

import java.util.Arrays;

/**
 * LeetCode-455
 * @Author: zhang kai
 * @Date: 2023/05/05
 * @Description:
 */
public class S7 {
    public static void main(String[] args) {

    }
    public int findContentChildren(int[] g, int[] s) {
        //将小孩根据饥饿感排序
        Arrays.sort(g);
        //将饼干根据大小排序
        Arrays.sort(s);
        int child = 0;
        int cookie = 0;
        while (child < g.length && cookie < s.length) {
            if (g[child] <= s[cookie]) {
                child++;
            }
            cookie++;

        }

        return child;
    }
}
